<?php

namespace bee;

abstract class globals extends singleton
{
protected static $__instance;

  public static function getInstance()
  { //die("ins ...");
    $classname = get_called_class();
    if(!(static::$__instance instanceof self))
    {
      if(!(static::$__instance = factory::load("bee_globals")))
      {
        static::$__instance = new $classname();
      //echo "-$classname-" . print_r(static::$__instance, true) . "++";
      }
    }
    $dispatcher = dispatcher::getInstance();
    $dispatcher->addobject(static::$__instance);

    return static::$__instance;
  }

  public function unLoad($evt)
  {
    factory::save($this, "bee_globals");
  }

}